home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2946 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  53 lines

  1. Path: bunyip.cc.uq.oz.au!news
  2. From: coonsta@peg.apc.org
  3. Newsgroups: comp.lang.c
  4. Subject: Q: Getting data from a FAR CHAR * buffer: HELP!
  5. Date: 25 Jan 1996 04:47:04 GMT
  6. Organization: University of Queensland
  7. Message-ID: <4e7208$iqb@dingo.cc.uq.oz.au>
  8. NNTP-Posting-Host: t27.dialup.peg.apc.org
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  13.  
  14. Here is the structure and relevant buffer, which contains the data I want 
  15. to extract (ultimately, I want plain ints):
  16.  
  17. typedef struct pcx_picture_typ
  18. {
  19.         pcx_header header;          //Forget it: it's irrelevant
  20.         RGB_color pallette[256];    //Forget this too.
  21.         char far *buffer;           //That's the one.
  22. } pcx_picture, *pcx_picture_pointer;
  23.  
  24.  
  25. Every pcx_picture is initalised with this call, which allocates memory 
  26. for the buffer.  I don't think it makes any difference, but here 'tis:
  27.  
  28. void PCX_Init(pcx_picture_ptr image)
  29. {
  30.         image->buffer = (char far *)_fmalloc(64000);
  31. }
  32.  
  33. Anywho... say I have an integer called x, and I want the data in 
  34. buffer[32000], what would I do?  E.G.
  35.  
  36. void main(void)
  37. {
  38.         int x;
  39.         pcx_picture thepicture;
  40.  
  41.         .    (The buffer is initialised and filled with data from a file
  42.         .    in here).
  43.         .
  44.  
  45.         x = thepicture.buffer[32000];   // doesn't seem to work.
  46. }
  47.  
  48.  
  49. can ANYBODY PLEASE help!
  50. -Dom 'The Definitive Newbie' Cooney.
  51.  
  52.  
  53.